<?php
/**
 * Created by PhpStorm.
 * User: huangj11
 * Date: 2021/1/14
 * Time: 19:30
 */

namespace console\controllers\bigdata;

use business\elasticsearch\services\SupplierWordsService;
use yii\console\Controller;

class SupplierWordsController extends Controller
{


    public function actionFull()
    {
        try {
            echo '开始时间' . microtime() . PHP_EOL;
            $service = new SupplierWordsService(true);
            $service->saveIndex();
            echo '结束时间' . microtime()  . PHP_EOL;
        } catch (\Exception $ex){
            \Yii::error($ex->getMessage());
            echo '数据调度出错，错误信息：'.$ex->getMessage();
        }
    }

    public function actionIncrement()
    {
        try {
            echo '开始时间' . microtime() . PHP_EOL;
            $service = new SupplierWordsService();
            $service->saveIndex();
            echo '结束时间' . microtime()  . PHP_EOL;
        } catch (\Exception $ex){
            \Yii::error($ex->getMessage());
            echo '数据调度出错，错误信息：'.$ex->getMessage();
        }
    }

}